<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Example: Fixed Page Template</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
    <link rel="stylesheet" href="../assets/css/main.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <script src="../../build/yui/yui-min.js"></script>
</head>
<body>

<div id="doc">
    <h1>Example: Fixed Page Template</h1>

    

    <div class="yui3-g">
        <div id="main" class="yui3-u">
            <div class="content"><div class="intro">
    <p>This example demonstrates how to create a fixed width page using YUI Grids.</p>
</div>

<div class="example newwindow">
    <a href="cssgrids-fixed-example.html" target="_blank" class="button">
        View Example in New Window
    </a>
</div>

<p>A fixed grid starts with the basic markup structure of a <code>yui3-g</code> grid and some <code>yui3-u</code> units.  For this example, we will create a 970px page and use <code>yui-u-1-5</code> to make the left column 194px, and <code>yui-2-5</code> to split the other 2 into 388px columns each.</p>
<h3>Basic Markup Structure</h3>

<pre class="code prettyprint">&lt;div class=&quot;yui3-g&quot;&gt;
    &lt;div class=&quot;yui3-u-1-5&quot;&gt;&lt;&#x2F;div&gt;
    &lt;div class=&quot;yui3-u-2-5&quot;&gt;&lt;&#x2F;div&gt;
    &lt;div class=&quot;yui3-u-2-5&quot;&gt;&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;</pre>


<h3>Adding Content</h3>
<p>As with all <code>yui3-u-*</code> units, to avoid layout complications, all column styling should be applied to a container within the unit rather than on the unit itself.
For this demo we will add a container with the class <code>content</code> to contain our content, but you can feel free to call this whatever you like.</p>

<pre class="code prettyprint">&lt;div class=&quot;yui3-g&quot;&gt;
    &lt;div class=&quot;yui3-u-1-5&quot;&gt;
        &lt;div class=&quot;content&quot;&gt;

        &lt;&#x2F;div&gt;
    &lt;&#x2F;div&gt;
    &lt;div class=&quot;yui3-u-2-5&quot;&gt;
        &lt;div class=&quot;content&quot;&gt;

        &lt;&#x2F;div&gt;
    &lt;&#x2F;div&gt;
    &lt;div class=&quot;yui3-u-2-5&quot;&gt;
        &lt;div class=&quot;content&quot;&gt;

        &lt;&#x2F;div&gt;
    &lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;</pre>


<h3>Fixing the Page Width</h3>
<p>To fix the size of the page, simply apply a width to the outermost page container.  For this example, we will apply the <code>ID</code> <code>doc</code> to the <code>body</code> element and apply the width there.  To center the layout, set the margin to <code>auto</code>.</p>

<pre class="code prettyprint">&lt;style&gt;
#doc {
    margin:auto; &#x2F;* center in viewport *&#x2F;
    width: 970px; &#x2F;* fix page width *&#x2F;
}
&lt;&#x2F;style&gt;</pre>


<h3>Adding Gutters and other Column Styling</h3>
<p>The <code>content</code> container is where margins between columns ("gutters"), padding, borders, and other content styling can be applied.</p>

<pre class="code prettyprint">&lt;style&gt;
.yui3-g .content {
    border: 2px solid #000;
    margin-right:10px; &#x2F;* &quot;column&quot; gutters *&#x2F;
    padding: 1em;
}
&lt;&#x2F;style&gt;</pre>

</div>
        </div>

        <div id="sidebar" class="yui3-u">
            

            
                <div class="sidebox">
                    <div class="hd">
                        <h2 class="no-toc">Examples</h2>
                    </div>

                    <div class="bd">
                        <ul class="examples">
                            
                                
                                    <li data-description="Each unit has a className that provides its percentage width.">
                                        <a href="cssgrids-units.html">Using Grid Units</a>
                                    </li>
                                
                            
                                
                                    <li data-description="This is a template for creating fixed-width layouts.">
                                        <a href="cssgrids-fixed.html">Fixed Page Template</a>
                                    </li>
                                
                            
                                
                                    <li data-description="This is a template for creating fluid layouts.">
                                        <a href="cssgrids-fluid.html">Fluid Page Template</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Basic CSS properties are leveraged to horizontally and vertically align units.">
                                        <a href="cssgrids-align.html">Aligning Grid Units</a>
                                    </li>
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                            
                        </ul>
                    </div>
                </div>
            

            
                <div class="sidebox">
                    <div class="hd">
                        <h2 class="no-toc">Examples That Use This Component</h2>
                    </div>

                    <div class="bd">
                        <ul class="examples">
                            
                                
                            
                                
                            
                                
                            
                                
                            
                                
                                    <li data-description="Creating left navigation using the MenuNav Node Plugin.">
                                        <a href="../node-menunav/menunav-leftnav.html">Basic Left Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Creating top navigation using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-2.html">Basic Top Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Creating menu button navigation using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-3.html">Menu Button Top Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Creating split button navigation using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-4.html">Split Button Top Nav</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Adding shadows to submenus of a left nav using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-5.html">Left Nav with Submenus with Shadows</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Adding rounded corners to submenus of a left nav using the MenuNav Node Plugin">
                                        <a href="../node-menunav/node-menunav-6.html">Left Nav With Submenus With Rounded Corners</a>
                                    </li>
                                
                            
                                
                                    <li data-description="Skining a menu built using the MenuNav Node Plugin to look like the menus on Flickr">
                                        <a href="../node-menunav/node-menunav-7.html">Skinning Menus Created Using the MenuNav Node Plugin</a>
                                    </li>
                                
                            
                        </ul>
                    </div>
                </div>
            
        </div>
    </div>
</div>

<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>

</body>
</html>
